home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Tools - Objects / MacApp / MacApp 2.0 CD Release / MacApp 2.0 (Many Libraries) / Interfaces / PInterfaces / UDebug.p < prev    next >
Encoding:
Text File  |  1990-03-27  |  5.8 KB  |  158 lines  |  [TEXT/MPS ]

  1. {[a-,body+,h-,o=100,r+,rec+,t=4,u+,#+,j=20/57/1$,n-]}
  2. { UDebug.p }
  3. { Copyright © 1985-1990 by Apple Computer, Inc.  All rights reserved. }
  4.  
  5. {$IFC UNDEFINED UsingIncludes}
  6. {$SETC UsingIncludes := FALSE}
  7. {$ENDC}
  8.  
  9. {$IFC NOT UsingIncludes}
  10. UNIT UDebug;
  11.  
  12.     INTERFACE
  13.         {$ENDC}
  14.  
  15.         {$IFC UNDEFINED __UDebug__}
  16.         {$SETC __UDebug__ := FALSE}
  17.         {$ENDC}
  18.  
  19.         {$IFC NOT __UDebug__}
  20.         {$SETC __UDebug__ := TRUE}
  21.  
  22.         { • Auto-Include the requirements for this unit's interface. }
  23.         {$SETC UDebugIncludes := UsingIncludes}
  24.         {$SETC UsingIncludes := TRUE}
  25.         {$I+}
  26.         {$IFC UNDEFINED __UMacAppUtilities__} {$I UMacAppUtilities.p} {$ENDC}
  27.         {$SETC UsingIncludes := UDebugIncludes}
  28.  
  29.         CONST
  30.             kMaxFlags            = 20;                    { maximum flags that can be remembered by
  31.                                                          the debugger }
  32.             kMaxSyms            = 20;                    { maximum symbols remembered by the debugger
  33.                                                          }
  34.  
  35.         TYPE
  36.             DebugForceOptions    = (forceOn, forceOff, forceUnchanged);
  37.             { Used with DebugForceOptions procedure. }
  38.  
  39.         VAR
  40.             gMastReport:        BOOLEAN;                { When TRUE, report changes in # master
  41.                                                          pointers. }
  42.             gMaxStackDepth:     LONGINT;                { Maximum stack space used to date in the
  43.                                                          program. This is computed every
  44.                                                          %_BP/%_EP/%_EX. }
  45.             gReportInfo:        Str255;                 { If gReportNext and gReportInfo <>'' then
  46.                                                          display the text of gReportInfo on next
  47.                                                          %_BP or %_EP, then clear the buffer. }
  48.             gReportNext:        BOOLEAN;                { If set to TRUE, report pending information
  49.                                                          (e.g., gReportInfo) at the very next %_BP
  50.                                                          or %_EP. }
  51.             gReportTime:        BOOLEAN;                { if TRUE, report TickCount during tracing }
  52.             gSingleStep:        BOOLEAN;                { if TRUE, break into debugger at next
  53.                                                          opportunity }
  54.             gTracing:            BOOLEAN;                { TRUE when the debugger is tracing. Set
  55.                                                          this using TrcEnable function. }
  56.  
  57.         FUNCTION DebugCanReadLn: BOOLEAN;
  58.         { Returns True if you can ReadLn to the user. This in turn is true when there is a debug view
  59.         (pDebugView), that view can currently write to its window, and this unit is initialized. }
  60.  
  61.         FUNCTION DebugCanWriteLn: BOOLEAN;
  62.         { Returns true if you can WriteLn to the user in the debug window. This is true if there
  63.         exists a debug view and this unit is initialized. }
  64.  
  65.         PROCEDURE GetCallersMethodName(VAR s: MAName);
  66.         { Return the name of the calling method in s. }
  67.  
  68.         PROCEDURE GetMethodName(ppc: LONGINT;
  69.                                 VAR s: MAName);
  70.         { Returns in s the name of the method or procedure into which address ppc points. Calls
  71.         GetProcName to do the work. }
  72.  
  73.         PROCEDURE GetProcName(ppc: LONGINT;
  74.                               VAR className, procName: MAName);
  75.         { Returns in procName the name of the method, procedure, or function into which address ppc
  76.         points. If it is a method, the method's class is returned in className. If not a method,
  77.         className is set to ''. }
  78.  
  79.         PROCEDURE ShowMemory(startAddress, numBytes: LONGINT);
  80.         { Dump memory to Transcript from startaddress for numBytes }
  81.  
  82.         PROCEDURE IDUDebug;
  83.         { Prints in the debug window the compile date and time of this unit. }
  84.  
  85.         FUNCTION TrcEnable(okToTrace: BOOLEAN): BOOLEAN;
  86.         { When a WriteLn call is made, the captureregistered through this function is called with the
  87.         sequence }
  88.  
  89.         {$IFC qPerform}
  90.  
  91.         FUNCTION DebugPerfMonitor(turnOn: BOOLEAN): BOOLEAN;
  92.         { When a WriteLn call is made, the captureregistered through this function is called with the
  93.         sequence }
  94.         {$EndC}
  95.  
  96.         {$IFC qDebug}
  97.  
  98.         FUNCTION DebugCapture(captureProc: ProcPtr): ProcPtr;
  99.         { When a WriteLn call is made, the captureproc registered through this function is called
  100.         with the sequence:
  101.         captureProc(textBuf: Ptr; byteCount: INTEGER);
  102.         The return value is the address of the previous captureProc. The debug view's AddText method
  103.         is called immediately after the captureProc.}
  104.  
  105.         FUNCTION DebugRedirect(vRefnum: INTEGER;        {CONST}
  106.                                fileName: StringPtr): OSErr;
  107.         { Returns number of characters per line in current transcript window. }
  108.  
  109.         FUNCTION DebugTranscriptWidth: INTEGER;
  110.         { Returns number of characters per line in current transcript window. }
  111.  
  112.         PROCEDURE EnterMacAppDebugger;
  113.         { Invokes the debugger. Called by ProgramBreak in UFailure. }
  114.  
  115.         PROCEDURE DebugEndForce;
  116.         { Calls the EndForce method of the debug view (see UTranscriptView.) }
  117.  
  118.         PROCEDURE DebugFlag(flagAddr: BooleanPtr;
  119.                             flagChar: CHAR;
  120.                             theActionProc: ProcPtr;
  121.           {CONST}
  122.                             flagDesc: StringPtr);
  123.         { Register a BOOLEAN flag for the X debugger command; flagAddr should be the address of the
  124.         flag; theActionshould be a procPtr for a to be called to change the flag (optional - may be
  125.         NIL).flagChar should be the character to use in the debugger to toggle the flag; desc
  126.         should be a short description of the flag.No checking is done for duplicate flagChars. }
  127.  
  128.         PROCEDURE DebugForceOutput(DebugToWindow, DebugToFile: DebugForceOptions);
  129.         { Calls the ForceOutput method of the debug view (see UTranscriptView.) }
  130.  
  131.         PROCEDURE DebugGlobalHandle(globAddr: Ptr;
  132.                                     theActionProc: ProcPtr; {CONST}
  133.                                     globSym: MANamePtr);
  134.         { Register a symbol name of a global variable that contains a handle; case does not matter.
  135.         The global variable should contain a Handle.The Action is a Function to be called to derive
  136.         the handle if necessary. Symbolic handles registered in this way may be entered in response
  137.         to the F and I commands of the debugger. }
  138.  
  139.         PROCEDURE DebugShowTranscriptWindow;
  140.         { Opens the debug transcript window. }
  141.  
  142.         PROCEDURE DebugTerminate;
  143.         { Called to initialize the UDebug unit. }
  144.  
  145.         PROCEDURE InitUDebug(segTable, nonRes: Handle;
  146.                              enterProc, inspectProc, symbolProc: Ptr);
  147.  
  148.         PROCEDURE InitUDebugAfterIApplication;
  149.         { Call this once at the end of IApplication to finish initialization of the debugger.
  150.         Installs the debug window in the event handler chain and installs a print handler in the
  151.         debug view. }
  152.  
  153.         {$ENDC qDebug}
  154.         {$EndC}
  155.         {$IFC NOT UsingIncludes}
  156. END.
  157. {$ENDC}
  158.